from django.urls import path
from rest_framework import routers
from server.views import UserViewSet, register, ArticleViewSet, CommentViewSet, \
    NotificationViewSet, logout, LoginView, MyTokenRefreshView, UserInfoViewSet
from rest_framework_simplejwt.views import (
    TokenRefreshView,
)

router = routers.DefaultRouter()
router.register(r'users', UserViewSet)
router.register(r'userinfos', UserInfoViewSet)
router.register(r'articles', ArticleViewSet)
router.register(r'comments', CommentViewSet)
router.register(r'notifications', NotificationViewSet)

urlpatterns = [
    path('login/', LoginView.as_view(), name='login'),
    path('refresh_token/', MyTokenRefreshView.as_view(), name='refresh_token'),
    path('register/', register, name='register'),
    path('logout/', logout, name='logout')
]

urlpatterns += router.urls
